import * as Router from 'koa-router'
import routers from '../../routers'
export default async ({ logger }) => {
    const router = new Router();
    router.all('/', async (ctx, next) => {
        //跳转到入口页面
        await ctx.send('index.html')
        // await ctx.render('index')
        // return 'abc'; 
    })
    // router.all('/test/test/abc', async (ctx, next) => {
    //     //跳转到入口页面
    //     ctx.body = '111';
    //     ctx.send('index.html')
    //     // ctx.render('pug/index.pug')
    //     // return 'abc';
    // })
    const routerItems = routers.get({ logger });
    routerItems.forEach(routerItem => {
        router.use(routerItem.router.routes(), routerItem.router.allowedMethods());
    });

    return [
        router.routes(), router.allowedMethods()
    ]
}  